package com.mpyy.handler.purchase;

import com.mpyy.cpinyin.PinyinException;
import com.mpyy.cpinyin.PinyinHelper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @version 1.0
 * @Descoription GeneratePinyinSpelling
 * @Author CG
 * @date 2022-03-24
 */
@Controller
public class GeneratePinyinSpellingHandler {

    @RequestMapping(value = "/generatePinyinSpelling/{proAlias}")
    @ResponseBody
    public  String generatePinyinSpelling(@PathVariable String proAlias) throws PinyinException {

        String shortPinyin = PinyinHelper.getShortPinyin(proAlias);

        return String.valueOf(shortPinyin);
    }

}
